home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / Chassis 6.0 ƒ / myIdleProc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-22  |  1.4 KB  |  39 lines  |  [TEXT/KAHL]

  1. /************************************************************************************/
  2. /*    myIdleProc                                                                        */
  3. /*                                                                                    */
  4. /*    Note:    executed repeatedly by the Print Manager.  Draws the text in the dialog    */
  5. /*            window then checks for a command-period.  If so, signals to abort the    */
  6. /*            print.                                                                    */
  7. /*                                                                                    */
  8. /*            DrawString was chosen as a method because DrawDialog and TextBox both    */
  9. /*            cause excessive flickering because they erase the dialog box each time.    */
  10. /************************************************************************************/
  11.  
  12. #include "MyHeaders.h"
  13.  
  14. pascal void myIdleProc()
  15. {
  16.     GrafPtr        oldPort;                        /* current grafport pointer            */
  17.     Str255        msgStr;                            /* message to print                    */
  18.  
  19.     GetPort(&oldPort);                            /* save the current print grafport    */
  20.     SetPort(myDlogPtr);                            /* set the dialog grafport            */
  21.     
  22.     GetIndString (msgStr, 141,1);                /* Printing in progress message        */
  23.     MoveTo (25,40);
  24.     DrawString (msgStr);
  25.  
  26.     if (GetNextEvent (keyDownMask, &myEvent))
  27.         {
  28.         if (BitAnd(myEvent.modifiers,cmdKey) != 0)    /* If command key is down...    */
  29.             {
  30.             testChar = BitAnd(myEvent.message,charCodeMask);
  31.             if (testChar == '.')                    /* ...and also period key...    */
  32.                 PrSetError(iPrAbort);                /* then send abort signal        */
  33.             }
  34.         }
  35.  
  36.     SetPort(oldPort);                            /* restore the print grafport        */
  37.     return;
  38. }
  39.